﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PCManager_V0._1 {
    public partial class m_FrmMain : Form {

        Button DefaultButtonTab {
            get {
                return m_btnPower;
            }
        }

        public m_FrmMain() {
            InitializeComponent();
        }

        private void m_FrmMain_Load(object sender, EventArgs e) {
            EnableButtonTabs(DefaultButtonTab);
        }

        private void OnAboutPCManagerV0_1Click(object sender, EventArgs e) {
            m_FrmAbout frmAbout = new m_FrmAbout();
            frmAbout.ShowDialog(this);
        }

        private void EnableButtonTabs(Button activeBtn) {
            foreach (Control control in m_pnlMainButton.Controls) {
                if (control is Button) {
                    if (control != activeBtn) {
                        control.BackColor = Color.Transparent;
                    }
                }
            }
            activeBtn.BackColor = Color.White;
        }

        private void ClearContentPanel() {
            m_pnlMainContent.Controls.Clear();
        }

        private void m_btnPower_Click(object sender, EventArgs e) {
            EnableButtonTabs((Button)sender);
            ClearContentPanel();
            PowerFuncUC powerUC = new PowerFuncUC();
            powerUC.Dock = DockStyle.Fill;
            m_pnlMainContent.Controls.Add(powerUC);
        }

        private void m_btnNote_Click(object sender, EventArgs e) {
            EnableButtonTabs((Button)sender);
            ClearContentPanel();
        }
    }
}
